package com.oyo.common.enums;

/**
 * 房单状态（基于bookingStatus添加 中文解释）
 *
 * @author EDZ
 */
public enum OrderStatus {
    CONFIRM_BOOKING(0, "待入住"),
    CHECKED_IN(1, "入住"),
    CHECKED_OUT(2, "离店"),
    CANCELLED_BOOKING(3, "取消"),
    // 目前房单中无下列状态，留存防止以后有用
    NO_SHOW(4, "noshow"),
    OWNER_BOOKING(5, "ownerbooking"),
    BLOCKED(6, "blocked"),
    HOLD(7, "hold"),
    UNPROCESSED(8, "unprocessed"),
    NEED_MANUAL_INTERVENTION(9, "needmanualintervention"),
    NEED_MANUAL_OVER_BOOKING(10, "needmanualoverbooking"),
    NEED_MANUAL_BULK(11, "needmanualbulk"),
    SAVED(12, "SAVED"),
    VOID_BOOKING(13, "voidbooking"),
    UNKNOWN(1000, "未知状态");

    int code;
    String name;

    OrderStatus(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(int code) {
        OrderStatus[] types = values();
        for (OrderStatus type : types) {
            if (type.getCode() == code) {
                return type.getName();
            }
        }
        return UNKNOWN.name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
